<html>
<head><meta charset="utf-8"><title>StorageLive/Dead in consts · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/StorageLive.2FDead.20in.20consts.html">StorageLive/Dead in consts</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="169009395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/StorageLive/Dead%20in%20consts/near/169009395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/StorageLive.2FDead.20in.20consts.html#169009395">(Jun 26 2019 at 08:28)</a>:</h4>
<p>We have a comment in <code>eval_context.rs</code> that says "// statics and constants don't have <code>Storage*</code> statements, no need to look for them". But that doesn't seem true any more, check the MIR of this:<br>
<a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=a31c523fb2599970eb92fd4be73e6261" target="_blank" title="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=a31c523fb2599970eb92fd4be73e6261">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=a31c523fb2599970eb92fd4be73e6261</a></p>



<a name="169009400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/StorageLive/Dead%20in%20consts/near/169009400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/StorageLive.2FDead.20in.20consts.html#169009400">(Jun 26 2019 at 08:28)</a>:</h4>
<p>was that a deliberate change? Cc <span class="user-mention" data-user-id="124288">@oli</span></p>



<a name="169009440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/StorageLive/Dead%20in%20consts/near/169009440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/StorageLive.2FDead.20in.20consts.html#169009440">(Jun 26 2019 at 08:29)</a>:</h4>
<p>I'm not sure if the comment was ever true</p>



<a name="169009450"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/StorageLive/Dead%20in%20consts/near/169009450" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/StorageLive.2FDead.20in.20consts.html#169009450">(Jun 26 2019 at 08:29)</a>:</h4>
<p>This comment is from <em>very early</em> miri</p>



<a name="169009457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/StorageLive/Dead%20in%20consts/near/169009457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/StorageLive.2FDead.20in.20consts.html#169009457">(Jun 26 2019 at 08:29)</a>:</h4>
<p>when we still pushed stack frames for constants and statics</p>



<a name="169009510"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/StorageLive/Dead%20in%20consts/near/169009510" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/StorageLive.2FDead.20in.20consts.html#169009510">(Jun 26 2019 at 08:30)</a>:</h4>
<p>I remember adding that comment. It was true back then. :)</p>



<a name="169009521"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/StorageLive/Dead%20in%20consts/near/169009521" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/StorageLive.2FDead.20in.20consts.html#169009521">(Jun 26 2019 at 08:30)</a>:</h4>
<p>wait we don't do that any more?</p>



<a name="169009539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/StorageLive/Dead%20in%20consts/near/169009539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/StorageLive.2FDead.20in.20consts.html#169009539">(Jun 26 2019 at 08:30)</a>:</h4>
<p>CTFE has a stack frame for the outermost const/static item (and then the const fn it calls), doesn't it?</p>



<a name="169011200"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/StorageLive/Dead%20in%20consts/near/169011200" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/StorageLive.2FDead.20in.20consts.html#169011200">(Jun 26 2019 at 08:59)</a>:</h4>
<p>yea, but we used to also push stack frames for referenced statics/constants if they weren't computed yet</p>



<a name="169027695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/StorageLive/Dead%20in%20consts/near/169027695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/StorageLive.2FDead.20in.20consts.html#169027695">(Jun 26 2019 at 13:13)</a>:</h4>
<p>yeah I remember, we used to compute statics/consts with the Miri machine on the same stack as the "main" program</p>



<a name="169027709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/StorageLive/Dead%20in%20consts/near/169027709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/StorageLive.2FDead.20in.20consts.html#169027709">(Jun 26 2019 at 13:13)</a>:</h4>
<p>it was crazy^^</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>